package cn.rc.rcsystem.fallback;

import cn.rc.rcsystem.domain.LeaseOrderCar;
import cn.rc.rcsystem.exception.GlobalExceptionCodeEnum;
import cn.rc.rcsystem.feign.OlderService;
import cn.rc.rcsystem.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class OlderServiceFallbackFactory implements FallbackFactory<OlderService> {
    @Override
    public OlderService create(Throwable throwable) {
        return new OlderService() {
            @Override
            public JSONResult saveOrUpdate(LeaseOrderCar leaseOrderCar) {
                return JSONResult.error(GlobalExceptionCodeEnum.FALLBACK);
            }

            @Override
            public JSONResult addLeaseOrderCar(LeaseOrderCar leaseOrderCar) {
                return JSONResult.error(GlobalExceptionCodeEnum.FALLBACK);
            }
        };
    }
}
